[fid,er,file,line1]= getbfile('k:\manoj\workshop\ts\*.rts');
[TS,fid]=rts_in(fid);
fclose(fid);
ProcDef=SetDefault(TS.head.band);
ProcDef.len = floor(length(TS.matrix)/ProcDef.block);
ProcDef.SelStacks = ones([1 ProcDef.len]);  
[TS1,ProcDef]=putnoise(TS,ProcDef);
   

fid = fopen(line1,'rb'); 
[S,count]=fread(fid,1024,'uchar');
fclose(fid);

line1(end-2:end)='out';

fid = fopen(line1,'wb');


fwrite(fid,S,'uchar');
fwrite(fid,TS1.matrix,'long');
fclose(fid);
